import request from './request'
// const userSer = '/?ser=user';
const companyJobSer = '/?ser=companyJob'
const userSer='/?ser=user'
const transSer='/?ser=transmission'
const comSer='/?ser=community'
const delSer='/?ser=deliver'

//获取职位
export function getJobList(keywords,currentPage,pageSize){
    return request({
        url:'/job/jobBeginList'+companyJobSer,
        params: {keywords,currentPage,pageSize
        }
    })
}


export function getJob(jobId){
    return request({
        url:'/job/getJob'+companyJobSer,
        params: {jobId
        }
    })
}


export function getCompanyList(keywords,currentPage,pageSize){
    return request({
        url:'/company/companyList'+companyJobSer,
        params: {keywords,currentPage,pageSize
        }
    })
}

export function getCompany(companyId){
    return request({
        url:'/company/getCompany'+companyJobSer,
        params: {companyId
        }
    })
}
export function getCodeImg(time){
    return request({
        url:'/captcha'+userSer,
        method:'post',
        params:{
            time
        }
    })
}
export function getVideoList(keywords,currentPage,pageSize){
    return request({
        url:'/video/preachVideoList'+transSer,
        params: {keywords,currentPage,pageSize
        }
    })
}


export function getLiveList(keywords,currentPage,pageSize){
    return request({
        url:'/live/liveList'+transSer,
        params: {
            keywords,currentPage,pageSize
        }
    })
}

export function getVideo(videoId){
    return request({
        url:'/video/getVideo'+transSer,
        params: {
            videoId
        }
    })
}


export function getLive(liveId){
    return request({
        url:'/live/getLive'+transSer,
        params: {
            liveId
        }
    })
}

export function getRTList(filter,currentPage,pageSize){
    return request({
        url:'/resumeTemplate/resumeTemplateList'+transSer,
        params: {
            filter, currentPage,pageSize
        }
    })
}


export function getRT(resumeTemplateId){
    return request({
        url:'/resumeTemplate/getRT'+transSer,
        params: {
            resumeTemplateId
        }
    })
}

export function getNewsList(currentPage,pageSize){
    return request({
        url:'/news/newsList'+comSer,
        params: {
            currentPage,pageSize
        }
    })
}

export function getNews(newsId){
    return request({
        url:'/news/getNews'+comSer,
        params: {
            newsId
        }
    })
}


export function getArticleList(currentPage,pageSize,hasAuth){
    return request({
        url:'/article/articleList'+comSer,
        params: {
            currentPage,pageSize,hasAuth
        }
    })
}
export function getMyArticleList(userName,currentPage,pageSize){
    return request({
        url:'/article/myArticleList'+comSer,
        params: {
            userName,currentPage,pageSize
        }
    })
}
export function getCompanyUserList(companyName){
    return request({
        url:'/user/companyUser'+userSer,
        params: {
            companyName
        }
    })
}



export function getArticle(articleId){
    return request({
        url:'/article/getArticle'+comSer,
        params: {
            articleId
        }
    })
}

export function delArticle(articleId){
    return request({
        url:'/article/delArticle'+comSer,
        params: {
            articleId
        }
    })
}


export function delComment(commentId){
    return request({
        url:'/comment/delComment'+comSer,
        params: {
            commentId
        }
    })
}
export function publishComment(form){
    return request({
        url:'/comment/publishComment'+comSer,
        params: {
            form
        }
    })
}



export function addArticle(userName,titleinput,editorContent,articleType){
    return request({
        url:'/article/addArticle'+comSer,
        method: 'POST',
        params: {
            userName,titleinput,editorContent,articleType
        }
    })
}
export function editArticle(articleId,titleinput,editorContent,articleType){
    return request({
        url:'/article/editArticle'+comSer,
        method: 'POST',
        params: {
            articleId,titleinput,editorContent,articleType
        }
    })
}


export function getCommentList(articleId,currentPage,pageSize){
    return request({
        url:'/comment/articleComments'+comSer,
        params: {
            articleId ,currentPage,pageSize
        }
    })
}
export function getMyCommentList(userName,currentPage,pageSize){
    return request({
        url:'/comment/getMyCommentList'+comSer,
        params: {
            userName ,currentPage,pageSize
        }
    })
}


export function getResume(userName){
    return request({
        url:'/resume/getPersonResume'+delSer,
        params: {
            userName
        }
    })
}
export function deleteResume(resumeId){
    return request({
        url:'/resume/delResume'+delSer,
        params: {
            resumeId
        }
    })
}
export function addResume(infoForm){
    return request({
        url:'/resume/addResume'+delSer,
        params: {
            infoForm
        }
    })
}
export function updateResume(infoForm){
    return request({
        url:'/resume/updateResume'+delSer,
        params: {
            infoForm
        }
    })
}

export function deliverResume(form){
    return request({
        url:'/deliver/deliverResume'+delSer,
        params: {
            form
        }
    })
}


export function jobCollect(userId,jobId){
    return request({
        url:'/jobCollect/collectJob'+delSer,
        params: {
            userId,jobId
        }
    })
}
export function deleteCollect(jobCollectId){
    return request({
        url:'/jobCollect/deleteCollect'+delSer,
        params: {
            jobCollectId
        }
    })
}

export function getDeliverList(userId,state){
    return request({
        url:'/deliver/myDeliverList'+delSer,
        params: {
            userId,state
        }
    })
}

export function delDeliver(deliverId){
    return request({
        url:'/deliver/deleteDeliver'+delSer,
        params: {
            deliverId
        }
    })
}

export function getCollectJob(userId){
    return request({
        url:'/jobCollect/jobCollectList'+delSer,
        params: {
            userId
        }
    })
}

export function alipay(outTradeNo,  subject,  totalAmount,  body){
    return request({
        url:'/vip/alipay'+userSer,
        method:'post',
        params: {
            outTradeNo,subject,totalAmount,body
        }
    })
}
export function createVip(userId){
    return request({
        url:'/user/createVip'+userSer,
        params: {
            userId
        }
    })
}
export function getMessage(receiveUserName){
    return request({
        url:'/message/receiveMessage'+userSer,
        params: {
            receiveUserName
        }
    })
}

export function delMsg(messageId){
    return request({
        url:'/message/deleteMessage'+userSer,
        params: {
            messageId
        }
    })
}
